//
//  ZDQNewsTopicsTableViewCell.m
//  Alltelevisionnews
//
//  Created by dllo on 15/11/29.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "ZDQNewsTopicsTableViewCell.h"

@implementation ZDQNewsTopicsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
        
    }
    
    return self;
}


- (void)create {
    
    self.photoImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.photoImageView];
//    self.photoImageView.layer.borderWidth = 1;
    
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    //    self.titleLabel.layer.borderWidth = 1;
    self.titleLabel.numberOfLines = 0;
    
    self.timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.timeLabel];
    self.timeLabel.font = [UIFont systemFontOfSize:15];
    //    self.timeLabel.layer.borderWidth = 1;
    
    self.websiteLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.websiteLabel];
    //    self.websiteLabel.layer.borderWidth = 1;
    self.websiteLabel.textAlignment = NSTextAlignmentRight;
    self.websiteLabel.font = [UIFont systemFontOfSize:13];
    
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    [self.photoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).with.offset(10);
        make.bottom.equalTo(self.contentView).with.offset(-10);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.equalTo(self.contentView.mas_width).with.offset(-self.contentView.frame.size.width / 3 * 2 - 10 * self.contentView.frame.size.width / 375);
        
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).with.offset(10);
        make.height.equalTo(self.contentView.mas_height).with.offset(-self.contentView.frame.size.height / 3 - 10);
        make.left.equalTo(self.photoImageView.mas_right).with.offset(10);
        make.right.equalTo(self.contentView).with.offset(-10);
        
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(0);
        make.bottom.equalTo(self.contentView).with.offset(-10);
        make.left.equalTo(self.photoImageView.mas_right).with.offset(10);
        make.width.equalTo(self.contentView.mas_width).with.offset(-self.contentView.frame.size.width / 4 * 3);
        
    }];
    
    [self.websiteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(0);
        make.right.equalTo(self.contentView).with.offset(-10);
        make.bottom.equalTo(self.contentView).with.offset(-10);
        make.width.equalTo(self.contentView.mas_width).with.offset(-self.contentView.frame.size.width / 4 * 3 - 10);
    }];
     
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
